package com.lp.stream;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

public class StreamTest {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");
        list.add("d");
        Optional<String> first = list.stream().filter(a -> "a".equals(a)).findFirst();
        String s = first.get();
        System.out.println(s);
    }
}
